import App from './App'

// #ifndef VUE3
import Vue from 'vue'
Vue.config.productionTip = false

Vue.prototype.myApi = function (promise) {
	// if (Loading) uni.showLoading({
	// 	title: '加载中。。。'
	// })
	let apiDomain = ''
	if(promise.domain){
		
		apiDomain = 'http://www.xxx.com'
	} else {
		apiDomain = 'https://www.xbiquge.la'
	}
	
	return new Promise(function (resolve, reject) {
		uni.request({
			url: apiDomain + promise.url,
			data: promise.data,
			method: !promise.method ? 'GET' : promise.method,
			success(res) {
				// if (Loading) uni.hideLoading()
				resolve(res.data)
			},
			fail(e) {
				// if (Loading) uni.hideLoading()
				uni.showToast({
					title: '网络异常',
					icon: 'none'
				})
				reject(e)
			}
		})
	})
}

App.mpType = 'app'
const app = new Vue({
    ...App
})
app.$mount()
// #endif

// #ifdef VUE3
import { createSSRApp } from 'vue'



export function createApp() {
  const app = createSSRApp(App)
  return {
    app
  }
}
// #endif

